Fix reporting of time intervals in the log mode of XenMon.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 6 Mar 2006 22:47:14 +0000 (23:47 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 6 Mar 2006 22:47:14 +0000 (23:47 +0100)
Fix duration to sleep between iterations (earlier hardcoded to 1sec)
Signed-off-by: Diwaker Gupta <dgupta@cs.ucsd.edu>
tools/xenmon/xenmon.py

index 4ccdf2f8c328722ba3ee3bba3daf8fdfd10766fb..a95f126a238661144bdbdc54e3519672c51ec341 100644 (file)
@@ -502,6 +502,7 @@ def writelog():
     shm = mmap.mmap(shmf.fileno(), QOS_DATA_SIZE)
 
     interval = 0
+    curr = last = time.time()
     outfiles = {}
     for dom in range(0, NDOMAINS):
         outfiles[dom] = Delayed("%s-dom%d.log" % (options.prefix, dom), 'w')
@@ -561,9 +562,10 @@ def writelog():
                                      h1[dom][4], 
                                      h1[dom][5][0], h1[dom][5][1]))
                     outfiles[dom].flush()
-
-        interval += options.interval
-        time.sleep(1)
+            curr = time.time()
+            interval += (curr - last) * 1000
+            last = curr
+        time.sleep(options.interval / 1000.0)
 
     for dom in range(0, NDOMAINS):
         outfiles[dom].close()